package com.example.myblog1_0.service;

import com.alibaba.fastjson.JSONObject;

import javax.xml.rpc.ServiceException;
import java.io.UnsupportedEncodingException;

/**
 * @Author: xc
 * @Date: 2018/11/8 11:41
 * @Description: qq登陆服务
 **/
public interface AuthService {
    /**
     * 根据code获得accessToken
     * @param code qq授权后会返回一个对应的code值
     * @return
     * @throws ServiceException
     */
    String getAccessToken(String code)throws ServiceException ;

    /**
     * 获得openid
     * @param accessToken
     * @return
     * @throws ServiceException
     */
    String getOpenId(String accessToken)throws ServiceException;

    /**
     * accessToken到期之后重新刷新
     * @param code
     * @return
     */
    String refreshToken(String code);

    /**
     *跳转链接
     * @return
     * @throws UnsupportedEncodingException
     */
    String getAuthorizationUrl() throws UnsupportedEncodingException;

    /**
     * 获得qq用户信息
     * @param accessToken
     * @param openId
     * @return
     * @throws ServiceException
     */
    JSONObject getUserInfo(String accessToken, String openId)throws ServiceException;
}
